<template>
	<view class="pageStyle">
		<view class="pageStyle_box" v-for="(item,index) in runList" :key="index" @click="lineItem(item,index)">
			<view class="pageStyle_box_left">
				<image src="./static/document.png" mode="" style="width:60rpx;height: 60rpx;border-radius: 12rpx;border-radius: 50%;"></image>
			</view>
			<view class="pageStyle_box_right">
				<view style="display: flex;align-items: center;">
					<text style="margin-right: 10rpx;">{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		getAction
	} from '@/utils/request.js';
	export default {
		data() {
			return {
				describe: '节点',
				list: [],
				runList: [],
				url: {
					list: '/visual/getModuleTree'
				},
				queryParam: {
					code: 'fileark_dir'
				},
				resultData: {},
				oldTreeList: [],
				idKey: 'code',
				rangeKey: 'name',
				num: 0
			};
		},
		onLoad(options) {
			let record = JSON.parse(options.record);
			this.search();
		},
		//下拉刷新
		onPullDownRefresh() {
			// #ifdef MP-WEIXIN
			this.search();
			wx.stopPullDownRefresh();
			// #endif

			// #ifdef APP-ANDROID || H5
			uni.startPullDownRefresh();
			this.search();
			uni.stopPullDownRefresh();
			// #endif

			// #ifdef APP-IOS || APP-HARMONY
			this.search();
			uni.stopPullDownRefresh();
			// #endif
		},
		methods: {
			search() {
				this.runList = [];
				this.getDataList();
			},
			getDataList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				getAction(this.url.list, this.queryParam).then(res => {
					this.resultData = res.data;
					if (this.resultData.list && this.resultData.list.length) {
						this.runList = this.resultData.list[0].children
					}
					uni.hideLoading();
				});
			},
			lineItem(item, index) {
				let record = {};
				record.code = 'document';
				record.treeNodeCode = item.code;
				uni.navigateTo({
					url: `/application/moduleList?record=${JSON.stringify(record)}&isTreeView=true`
				});
			}
		}
	};
</script>
<style lang="scss" scoped>
	.pageStyle {
		height: 100%;
		background-color: #fff;
		padding: 20rpx;


		&_box {
			display: flex;
			margin-bottom: 20rpx;

			&_left {
				margin-right: 20rpx;
			}

			&_right {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;
				border-bottom: 1px solid rgb(228, 228, 228);
				font-size: 28rpx;

			}
		}


	}
</style>